﻿Imports System.Web
Imports System.Text

Public Class Form1


    'Dim web As New System.Net.WebClient()

    'web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")

    'Dim d As Byte() = System.Text.Encoding.ASCII.GetBytes("SEARCHSTRING=test")
    'Dim res As Byte() = Web.UploadData("http://somewhere.com/search.asp", "POST", d)

    'msgbox(System.Text.Encoding.ASCII.GetString(res))

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim TTract As New Tracks
        ' MsgBox(EasyHttp.Send("http://api.soundcloud.com/tracks?limit=10"))
        Dim RD As New TrackDataReader(HttpRequest.Send("http://api.soundcloud.com/tracks?limit=10"))
        ' Dim RD As New TrackDataReader("C:\Documents and Settings\Administrator\Desktop\data.xml")
        RD.ReadData(TTract)
        TracksBindingSource.DataSource = TTract
    End Sub



    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        SoundCloudService.Read()



        'Dim consumerKey As String = "key"
        'Dim consumerSecret As String = "secret"
        'Dim uri As Uri = New Uri("http://term.ie/oauth/example/request_token.php")
        'Dim oAuth As SoundCload.OAuth.OAuthBase = New SoundCload.OAuth.OAuthBase

        'Dim nonce As String = OAuth.GenerateNonce()
        'Dim timeStamp As String = oAuth.GenerateTimeStamp()
        'Dim sig As String = sOAuth.GenerateSignature(Uri, consumerKey, consumerSecret, String.Empty, String.Empty, "GET", timeStamp, nonce, SoundCload.OAuth.OAuthBase.SignatureTypes.HMACSHA1, "", "")
        'sig = HttpUtility.UrlEncode(sig)
        'Dim sb As StringBuilder = New StringBuilder(uri.ToString())

        'sb.AppendFormat("?oauth_consumer_key={0}&", consumerKey)
        'sb.AppendFormat("oauth_nonce={0}&", nonce)
        'sb.AppendFormat("oauth_timestamp={0}&", timeStamp)
        'sb.AppendFormat("oauth_signature_method={0}&", "HMAC-SHA1")
        'sb.AppendFormat("oauth_version={0}&", "1.0")
        'sb.AppendFormat("oauth_signature={0}", sig)

        'Clipboard.Clear()
        'Clipboard.SetText(HttpUtility.UrlEncode(sb.ToString()))
        'System.Diagnostics.Debug.WriteLine(sb.ToString())
    End Sub
End Class
